﻿#pragma once
#include "scene.h"
#include "MuType.h"
#include "Model.h"
#include "Viewport.h"
#include "GuiCharacterMgr.h"
#include "GameObjectList.h"
#include "MuNetConnect.h"

class SceneCharacterMgr :
    public Scene, protected MuNetConnect::Listener
{
public:
	SceneCharacterMgr();
	virtual ~SceneCharacterMgr();

	CREATE_FUNC(SceneCharacterMgr)

	virtual bool Init();
	virtual void window_size_callback(int width, int height);
	virtual void mouse_button_callback(int button, int action, int mods);
	virtual void Update() override;

	Camera m_camera;
	Viewport m_viewport1;

	class Res
	{
	public:
		bool Load();
		Model *GetFace(MuType::CharacterClass muclass)
		{
			return m_face + muclass;
		}

		Model m_logoBackground;	//选择人物界面的背景
		Model m_face[4];	//法师头像,战士,弓箭手,魔剑士
		TextureManager m_texMgr;
	}m_res;

private:
	GameObjectList m_gameObjList1;
	GameObjectList m_characterList;
	bool m_enableMouseCheck;
	bool m_lbtnDown;
	bool m_mouseMove;

	RenderObject *m_currFocusObj;
	RenderObject *m_currSelectObj;

	GuiCharacterMgr m_gui;

	void cb_gui_btn_ok();
	void cb_obj_focus(GameObject *obj, bool focus);
	void cb_obj_select(GameObject *obj, bool select);

    // 继承 MuNetConnect::Listener
    virtual void on_gs_characterList(MuPack::CharacterList* characterList) override;

    virtual void on_cs_close() override;
    virtual void on_gs_close() override;
};

